package cn.dylan.feignClient;

import cn.dylan.domain.Store;
import cn.dylan.utils.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

@Component
public class StoreFeignClientFallback implements FallbackFactory<StoreFeignClient> {
    @Override
    public StoreFeignClient create(Throwable throwable) {
        return new StoreFeignClient() {
            @Override
            public JsonResult handlerAdd(Store store) {
                return JsonResult.me().setMsg("熔断了");
            }
        };
    }
}
